var ValidateFormLayer = new Class({
	initialize: function (form, options){
		if(!$('errorLayer')){
			var html = [
			'<div class="contentLayer">',
			'<div class="headLayer">',
			'<div class="contentHead context">',
			'<span class="floatL titre">&nbsp;</span>',
			'<span class="floatR"><a class="btnClose2 closeWindow layerClose" href="#">FERMER</a></span>',
			'</div>',
			'</div>',
			'<div class="bodyLayer">',
			'<div class="contentBody">',
			'<div class="block bgWhiteBorderGrey">',
			'<span class="topCorners"><span class="tl"></span><span class="tr"></span></span>',
			'<div class="blockInside">',
			'<div class="body mea meaLeft" id="errorLayerCtn">',
			'</div>',
			'</div>',
			'<span class="bottomCorners"><span class="bl"></span><span class="br"></span></span>',
			'</div>',
			'</div>',
			'</div>',
			'<div class="footLayer">',
			'<div class="contentFoot"></div>',
			'</div>',
			'</div>',
			'</div>'
			].join('');
			new Element('div', {id:"errorLayer", "class":"hidden layer", html: html}).inject(document.body);
		}

		new FormValidator.Inline(form, {
			onFormValidate: function(passed, form, event) {
				if (passed) {
					// here goes ajax submit
				}
				else {
					new FogManager("errorLayer", options);
				}
			},
			serial: true,
			scrollToErrorsOnSubmit: false
		});
	}
});
Moodule.register("ValidateFormLayer", "form.toValidateLayer", {styles:{backgroundColor:"000"}});
